package cn.edu.nju.software.greencreditsystem.DAOImpl;

import cn.edu.nju.software.greencreditsystem.DAO.FinancialWarningTypeDAO;
import cn.edu.nju.software.greencreditsystem.domain.FinancialWarningType;
import cn.edu.nju.software.greencreditsystem.factory.SessionPool;
import org.hibernate.Session;

/**
 * 作者：何启睿
 * 创建时间：2011-8-20
 * 类描述：FinancialWarningType类DAO实现
 */
public class FinancialWarningTypeDAOImpl implements FinancialWarningTypeDAO
{

    @Override
    public boolean save(FinancialWarningType fwt)
    {
        boolean result = false;
        
        Session s = SessionPool.getSession();
        try
        {
            s.beginTransaction();
            s.save(fwt);
            s.flush();
            s.getTransaction().commit();
            result = true;
        }catch(Exception ex)
        {
            ex.printStackTrace();
            s.getTransaction().rollback();
        }
        finally
        {
            s.close();
        }
        
        return result;
    }
    
}
